// 用来造页面的数据的

// 15.2
import { param2Obj } from '@/utils/urlUtis'

// 8.4引入mockjs 伪造不同的数据
import Mock from 'mockjs'
// 8.3
var List = []
for (var i = 0; i < 100; i++) {
    List.push(
        Mock.mock({
            
                id: Mock.mock('@guid()'),
                attendanceStatus: Mock.mock('@integer(0, 2)'), //0待接诊1接诊中2已完成
                patientsWithNumber: Mock.mock('@zip()'),
                name: Mock.mock('@cname()'),
                sex: Mock.mock('@integer(0, 1)'), //0男1女
                age: Mock.mock('@integer(1, 90)'),
                phone:/^[1][3-9][0-9]{9}$/,
                outpatientServiceType: Mock.mock('@integer(0, 1)'), //0出诊1已完成
                department: Mock.mock('@integer(0, 1)'), //0全科1全科
                doctor: "王冕",
                date: Mock.mock('@datetime()')
            
        })
    )
}

export default {

    getSituationData: config => {
        console.log('config',param2Obj(config.url));
        // 15.1 接收数据
        var { page, pageSize } = param2Obj(config.url)         //15.2引入工具类param2Obj
        var resLimit = List.filter((item, index) => {
            return (page - 1) * pageSize <= index && index < page * pageSize
        })
        return {
            code: 200,
            msg: '请求成功',
            data: resLimit,
            total: List.length
        }
    }
}

